const Mock = require('mockjs')
// 设备同步
const register = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        name: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备名称
        address: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备地址
        equipmentPosition: () => Mock.Random.string('0123456789', 12),    //设备位置
        districtPipe: '@string("number", 3)',   //区管地址
        zoneTube: '@string("number", 3)',   //区管位置
        groupNumber: '@string("number", 3)',   //组号
        position: '@string("number", 3)',   //位置
        digit: '@string("number", 3)',   //位数
        way: '@string("number", 3)',   //路数
        species: '@string("number", 3)',   //种类
        controls: '@string("number", 3)',   //操作状态
    }]
});
// 寄存器同步
const synchronization = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        name: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备名称
        centerControl: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //中控地址
        controlPanelType: () => Mock.Random.string('0123456789', 12),    //控制板类型
        controlPanelname: '@string("number", 3)',   //控制板名称
        portType: '@string("number", 3)',   //端口类型
        portNumber: '@string("number", 3)',   //端口序号
        dataName: '@string("number", 3)',   //数据名称
        registerOffset: '@string("number", 3)',   //寄存器偏移量
        registerAddress: '@string("number", 3)',   //寄存器地址
        controls: '@string("number", 3)',   //操作状态
    }]
});
// 逻辑设置
const logic = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        status: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //联控器状态
        intercontrollerPosition: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //联控器位置
        intercontrollerAddress: () => Mock.Random.string('0123456789', 12),    //联控器地址
        usgroupNumbere: '@string("number", 3)',   //设备组号
        orderPosition: '@string("number", 3)',   //指令位置
        executionCondition: '@string("number", 3)',   //执行条件
        controls: '@string("number", 3)',   //操作状态
    }]
});
// 计费设置
const charging = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        status: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //联控器状态
        intercontrollerPosition: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //联控器位置
        intercontrollerAddress: () => Mock.Random.string('0123456789', 12),    //联控器地址
        usgroupNumbere: '@string("number", 3)',   //设备组号
        orderPosition: '@string("number", 3)',   //指令位置
        executionCondition: '@string("number", 3)',   //执行条件
        controls: '@string("number", 3)',   //操作状态
    }]
});

// 设备配置
const equipment = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        name: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //自主命名
        dataName: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //数据名称
        flip: () => Mock.Random.string('0123456789', 12),    //逻辑值翻转
        register: '@string("number", 3)',   //逻辑值翻转寄存器地址
        time: '@string("number", 3)',   //消抖时间
        eliminationTime: '@string("number", 3)',   //消抖时间寄存器地址
        effective: '@string("number", 3)',   //预警有效
        status: '@string("number", 3)',   //状态
    }]
});
// 数字量配置
const figure = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        name: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //自主命名
        dataName: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //数据名称
        flip: () => Mock.Random.string('0123456789', 12),    //逻辑值翻转
        register: '@string("number", 3)',   //逻辑值翻转寄存器地址
        time: '@string("number", 3)',   //消抖时间
        eliminationTime: '@string("number", 3)',   //消抖时间寄存器地址
        effective: '@string("number", 3)',   //预警有效
        status: '@string("number", 3)',   //状态
    }]
});
// 模拟量配置
const simulate = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        name: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //自主命名
        dataName: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //数据名称
        signal: () => Mock.Random.string('0123456789', 12),    //逻辑值翻转
        ai: '@string("number", 3)',   //逻辑值翻转寄存器地址
        floor: '@string("number", 3)',   //消抖时间
        upperLimit: '@string("number", 3)',   //消抖时间寄存器地址
        effective: '@string("number", 3)',   //预警有效
        status: '@string("number", 3)',   //状态
    }]
});
// 设备校时
const timing = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        name: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //自主命名
        dataName: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //数据名称
        signal: () => Mock.Random.string('0123456789', 12),    //逻辑值翻转
        ai: '@string("number", 3)',   //逻辑值翻转寄存器地址
        floor: '@string("number", 3)',   //消抖时间
        upperLimit: '@string("number", 3)',   //消抖时间寄存器地址
        effective: '@string("number", 3)',   //预警有效
        status: '@string("number", 3)',   //状态
    }]
});
module.exports = [
    // 设备同步
    {
        url: '/vue-admin-template/register/register',
        type: 'get',
        response: config => {
            const items = register.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 寄存器同步
    {
        url: '/vue-admin-template/synchronization/synchronization',
        type: 'get',
        response: config => {
            const items = synchronization.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 逻辑设置
    {
        url: '/vue-admin-template/logic/logic',
        type: 'get',
        response: config => {
            const items = logic.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 计费设置
    {
        url: '/vue-admin-template/charging/charging',
        type: 'get',
        response: config => {
            const items = charging.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 设备配置
    {
        url: '/vue-admin-template/equipment/equipment',
        type: 'get',
        response: config => {
            const items = equipment.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 数字量配置
    {
        url: '/vue-admin-template/figure/figure',
        type: 'get',
        response: config => {
            const items = figure.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 模拟量配置
    {
        url: '/vue-admin-template/simulate/simulate',
        type: 'get',
        response: config => {
            const items = simulate.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
]